point_in_circle


描述

When using this function, you define a circular area and GameMaker Studio 2 will work out whether the given point falls within its bounds or not. If the point falls within the defined circle the function will return true otherwise the function will return false.


语法:

point_in_circle(px, py, x1, y1, rad);

参数 描述
px The x coordinate of the point to check.
py The y coordinate of the point to check.
x1 The x coordinate of the circle centre.
y1 The y coordinate of the circle centre.
rad The radius of the circle.


返回:

Boolean(布尔值)


例如:

if point_in_circle(mouse_x, mouse_y, x, y, 16)
   {
   over = true;
   }
else
   {
   over = false;
   }

The above code uses the point_in_circle function to check if the mouse position falls within the defined circular area, setting the variable "over" to true if it does, or false otherwise.